<!DOCTYPE html>
<html>
<head>
    <title>平涛</title>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="description" content="Write an awesome description for your new site here. You can edit this line in _config.yml. It will appear in your document head meta (for Google search results) and in your feed.xml site description.
">

    <link rel="stylesheet" type="text/css" href="__PUBLIC__/Wechat/css/weui.min.css">
    <link rel="stylesheet" type="text/css" href="__PUBLIC__/Wechat/css/jquery-weui.css">
    <link rel="stylesheet" type="text/css" href="__PUBLIC__/Wechat/css/demos.css">
    <link rel="stylesheet" type="text/css" href="__PUBLIC__/Wechat/css/style.css">
    <link rel="stylesheet" type="text/css" href="__PUBLIC__/Wechat/css/aui-iconfont.css">

    <style type="text/css">
        .weui_cells_title{margin-top: 0px !important;margin-bottom: 0px !important;padding-top: 3px;padding-bottom: 3px;background: #eee;}
        /*.weui_navbar_item.weui_bar_item_on{background: #fff !important}*/

        .weui_cell_primary{padding-top: 5px;padding-left: 35px;}
        .weui_cell{padding: 10px 15px !important;}
        .weui_cells{margin-top: 0px !important}
        .weui_media_desc{line-height: 1.5 !important}
        .weui_navbar+.weui_tab_bd{padding-top: 47px !important}
    </style>

</head>


<body ontouchstart>

    <div class="weui_tab">
        <div class="weui_navbar weui_navbar1">
            <div class="weui_navbar_item weui_bar_item_on">
                <span>首页</span>
            </div>
        </div>

        <div class="weui_tab_bd">
            <div class="weui_cells_title">我的提醒</div>
            <div class="weui_panel_bd">
                <div class="weui_media_box weui_media_text" id="out-remind">
                    <h4 class="weui_media_title">拜访提醒</h4>
                    <!-- <div class="weui_media_desc">拜访客户：客户一</div>
                    <div class="weui_media_desc">拜访时间：2017/01/01</div> -->
                </div>
                <div class="weui_media_box weui_media_text" id="other-remind">
                    <h4 class="weui_media_title">其他提醒</h4>
                    <!-- <div class="weui_media_desc">1.某某客户：负责人1生日（2017/01/24）</div>
                    <div class="weui_media_desc">2.某某客户：负责人2生日（2017/01/24）</div>
                    <div class="weui_media_desc">3.某某客户：店庆（2017/01/24）</div> -->
                </div>
            </div>

            <!-- <div class="weui_cells_title">我的问题单</div>
            <div class="weui_panel_bd">
                <div class="weui_media_box weui_media_text">
                    <h4 class="weui_media_title">未解决问题</h4>
                    <div class="weui_media_desc">1.待解决问题1</div>
                    <div class="weui_media_desc">2.待解决问题2</div>
                    <div class="weui_media_desc">3.待解决问题3</div>
                </div>
                <div class="weui_media_box weui_media_text">
                    <h4 class="weui_media_title">已解决问题</h4>
                    <div class="weui_media_desc">1.已解决问题1</div>
                    <div class="weui_media_desc">2.已解决问题2</div>
                    <div class="weui_media_desc">3.已解决问题3</div>
                </div>
            </div>  -->
        </div>

        <include file="Index/footer" />

    </div>

<script src="__PUBLIC__/Wechat/js/jquery-2.1.4.js"></script>
<script src="__PUBLIC__/Wechat/js/fastclick.js"></script>
<script src="__PUBLIC__/Wechat/js/jquery-weui.js"></script>
<script>
    $(function() {
        FastClick.attach(document.body);
        $.ajax({
            url: "{:U('Index/remind')}",
            success: function(data){
                console.log(data);
                // 外勤拜访提醒
                var outContent = '';
                if( data['out']['state'] == 200 ){
                    //alert( data['out']['content'].length );
                    for (var i = 0; i < data['out']['content'].length; ++i) {
                        outContent += '<div class="weui_media_desc">拜访客户：'+data["out"]["content"][i]["client_name"]+'</div><div class="weui_media_desc">拜访时间：'+data["out"]["content"][i]["appoint_time"]+'</div>';
                    }
                }else{
                    outContent = '<div class="weui_media_desc">无</div>';
                }
                $('#out-remind').append(outContent);

                // 其他提醒
                var otherContent = '';
                var num = 1;
                if( data['client']['state'] == 200 || data['contact']['state'] == 200){
                    if( data['client']['state'] == 200 ){
                        for (var i = 0; i < data['client']['content'].length; ++i) {
                            otherContent += '<div class="weui_media_desc">&nbsp;&nbsp;'+num+'. '+data["client"]["content"][i]["client_name"]+'：店庆（'+data["client"]["content"][i]["shop_birthday"]+'）</div>';
                            ++num;
                        }
                    }
                    if( data['contact']['state'] == 200 ){
                        for (var i = 0; i < data['contact']['content'].length; ++i) {
                            otherContent += '<div class="weui_media_desc">&nbsp;&nbsp;'+num+'. '+data["contact"]["content"][i]["client_name"]+'：'+data['contact']['content'][i]['realname']+'负责人生日（'+data["contact"]["content"][i]["birthday"]+'）</div>';
                            ++num;
                        }
                    }
                }else{
                    otherContent = '<div class="weui_media_desc">无</div>';
                }
                $('#other-remind').append(otherContent);
            }
        });
    });
</script>

</body>
</html>
